<!DOCTYPE html>
<html lang="en">
<!-- 管理员主页面 -->
<?php
// 判断是否正常访问
session_start();
if (!isset($_SESSION['ADMIN'])) {
    echo "<script>alert('非法访问！请先登录！');window.location.href='../../../index.html';</script>";
    die();
}
include_once('php/data-processing.php');
?>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="../img/ICO.png">
    <title>校园报修系统 · 管理员</title>
    <link rel="stylesheet" href="../layui-v2.9.18/layui/css/layui.css">
    <link rel="stylesheet" href="css/a-public.css">
    <link rel="stylesheet" href="css/a-main.css">
</head>

<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo layui-hide-xs layui-bg-black">
                <img src="../img/logo-0.png" height="100%">
            </div>
            <!-- 头部区域（可配合layui 已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <b class="layui-nav-item layui-show-xs-inline-block">
                    <i class="layui-icon layui-icon-date"></i> 日期：<span id="nowTime"></span> |
                    <i class="layui-icon layui-icon-time"></i> 时间：<span id="timeDisplay"></span>
                </b>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide layui-show-sm-inline-block">
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-friends"> 登录管理员：</i>
                        <?php echo $_SESSION['ADMIN']['a_name'];?>
                        <span> | </span><span id="welcome"></span>
                    </a>
                </li>
                <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                    <a href="php/logout.php">
                        <i class="layui-icon layui-icon-return" title="退出登录"></i>
                    </a>
                </li>
            </ul>
        </div>
        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a href="javascript:;">系统面板</a>
                        <dl class="layui-nav-child">
                            <dd class="layui-this"><a href="javascript:;">信息统计面板</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a class="" href="javascript:;">报修任务处理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="a-tasks-pending.php">待处理任务</a></dd>
                            <dd><a href="a-tasks-ongoing.php">进行中任务</a></dd>
                            <dd><a href="a-tasks-history.php">历史任务查询</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">维修人员管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="a-repairer.php">人员信息总览</a></dd>
                            <dd><a href="a-repairer-add.php">人员信息添加</a></dd>
                            <dd><a href="a-repairer-change.php">人员信息修改</a></dd>
                            <dd><a href="a-repairer-del.php">维修账号停启用</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item">
                        <a href="javascript:;">报修类型管理</a>
                        <dl class="layui-nav-child">
                            <dd><a href="a-type.php">报修类型总览</a></dd>
                            <dd><a href="a-type-change.php">修改报修类型</a></dd>
                            <dd><a href="a-type-add.php">添加报修类型</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
        </div>
        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px;">
                <blockquote class="layui-elem-quote layui-text">
                    您可以在此处看到一些系统信息，包括报修任务数量、维修人员数量、报修类型数量等。
                </blockquote>
                <div class="layui-card layui-panel" style="margin-bottom: 35px;">
                    <div class="layui-card-header main-header">
                        <i class="layui-icon layui-icon-chart-screen" style="margin-right: 10px;"></i>
                        <span class="main-header-title">平台数据总览</span> 
                    </div>
                    <div class="layui-card-body main-div">
                        <div class="main-div-item">
                            <p class="main-div-item-title">平台报修任务总数量</p>
                            <p class="main-div-item-num"><?php echo $all_recording;?></p>
                        </div>
                        <div class="main-div-item">
                            <p class="main-div-item-title">累计完成任务总数量</p>
                            <p class="main-div-item-num"><?php echo $all_finish;?></p>
                        </div>
                        <div class="main-div-item">
                            <p class="main-div-item-title">总完修比率</p>
                            <p class="main-div-item-num"><?php echo $all_finish_rate;?></p>
                        </div>
                    </div>
                    <div class="layui-card-header main-header">
                        <i class="layui-icon layui-icon-date" style="margin-right: 10px;"></i>
                        <span class="main-header-title">当日数据明细</span>
                    </div>
                    <div class="layui-card-body main-div">
                        <div class="main-div-item">
                            <p class="main-div-item-title">今日报修数量</p>
                            <p class="main-div-item-num"><?php echo $today_recording;?></p>
                        </div>
                        <div class="main-div-item">
                            <p class="main-div-item-title">今日维修数量</p>
                            <p class="main-div-item-num"><?php echo $today_finish;?></p>
                        </div>
                    </div>
                    <div class="layui-card-header main-header">
                        <i class="layui-icon layui-icon-chart" style="margin-right: 10px;"></i>
                        <span class="main-header-title">数据对比分析</span>
                    </div>
                    <div class="layui-card-body main-div">
                        <div class="main-div-item">
                            <p class="main-div-item-title">今日报修量较昨日增长</p>
                            <?php echo $record_increase;?></p>
                        </div>
                        <div class="main-div-item">
                            <p class="main-div-item-title">今日维修量较昨日增长</p>
                            <?php echo $finish_increase;?></p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-footer">
            <!-- 底部固定区域 -->
            校园报修系统© 2025®
        </div>
    </div>
    <script src="../layui-v2.9.18/layui/layui.js" charset="utf-8"></script>
    <script src="js/getDatetime.js"></script>
</body>

</html>